﻿@model IEnumerable<InAndOut.Models.Expense>

<div class="container p-3">
    <div class="row pt-4">
        <div class="col-6">
            <h2 class="text-primary">Expenses List</h2>
        </div>
        <div class="col-6 text-right">
            <a class="btn btn-primary" asp-controller="Expense" asp-action="Create"> Create New Expense</a>
        </div>


    </div>
    @if (Model.Count() > 0)
    {
        <table class="table table-bordered table-striped" style="width:100%">
            <thead>
                <tr>
                    <th>
                        Expense Name
                    </th>
                    <th>
                        Amount
                    </th>
                    <th>
                        Action
                    </th>
                </tr>
            </thead>
            <tbody>
                @foreach (var exp in Model)
                {
                    <tr>
                        <td width="35%">@exp.ExpenseName</td>
                        <td width="35%">@exp.Amount</td>
                        <td width="30%">
                            <div class="w-100 btn-group" role="group">
                                <a class="btn btn-info mx-1" asp-controller="Expense" asp-action="Update" asp-route-Id="@exp.Id">Update</a>
                                <a class="btn btn-danger mx-1" asp-controller="Expense" asp-action="Delete" asp-route-Id="@exp.Id">Delete</a>
                            </div>
                        </td>
                    </tr>
                }
            </tbody>

        </table>



    }
    else
    {
        <p>No Items Expended</p>
    }



</div>

